#include <g-bios.h>
#include <core/cmd.h>
#include <sysconf.h>
#include <string.h>
#include <core/getopt.h>
#include <flash/part.h>
#include <core/bar.h>


static int main(int argc, char *argv[])
{
	int nDevNum;


	switch (argc)
	{
	case 1:
		nDevNum = DEF_VOL_ID; // fixme: changing to OS root seems  more reasonable
		break;

	case 2:
		if(atoi(argv[1], &nDevNum) < 0 || nDevNum < 0)
		    goto L1;

		//pchVol[0] &= ~32;
		break;

	default:
		goto L2;
	}

	if (GuPartChange(nDevNum) < 0)
		goto L2;

	return 0;

L1:
	printf("Device \"%s\" is wrong!\n", argv[1]);
L2:
	printf("Usage: cd Device (For example: \"cd 0\").\n");
L3:
	return -EINVAL;
}


INSTALL_APPLICATION(cd, main, "Change current directory.");

